using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace PeoplesJukebox.Core.Configuration
{
    /// <summary>
    /// Track configuration, containing a collection of tracks
    /// </summary>
    public class TrackConfiguration : ConfigurationSection
    {
        private static TrackConfiguration current;

        /// <summary>
        /// Sets up the current settings from application config
        /// </summary>
        static TrackConfiguration()
        {
            current = ConfigurationManager.GetSection("trackConfiguration") as TrackConfiguration;
        }

        /// <summary>
        /// Returns the currently configuration settings
        /// </summary>
        public static TrackConfiguration Current
        {
            get { return current; }
        }

        /// <summary>
        /// Returns the collection of configured tracks
        /// </summary>
        [ConfigurationProperty(TrackConfiguration.SettingName.Tracks)]
        public TrackCollection ConfiguredTracks
        {
            get { return (TrackCollection)this[SettingName.Tracks]; }
        }

        /// <summary>
        /// Constants used for indexing settings
        /// </summary>
        private struct SettingName
        {
            public const string Tracks = "tracks";
        }
    }
}